package cn.sxt.clinic.mapper;

import cn.sxt.clinic.pojo.PrescriptionSurcharge;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ${author}
 * @since 2020-06-29
 */
public interface PrescriptionSurchargeMapper extends BaseMapper<PrescriptionSurcharge> {
    @Select("select p.*,d.dictionary_name surchargeName,d2.dictionary_name typeName\n" +
            " from t_prescription_surcharge p LEFT JOIN t_dictionary d\n" +
            " ON p.dictionary_id = d.dictionary_id LEFT JOIN t_dictionary d2\n" +
            "ON p.surcharge_type_id = d2.dictionary_id ${ew.customSqlSegment}")
    IPage<PrescriptionSurcharge> selectPrescriptionSurcharge(IPage<PrescriptionSurcharge> page,@Param(Constants.WRAPPER) QueryWrapper wrapper);
}
